/**********************************************************************************
 ***
 ***    Screencasting Teaching System C++ Library
 ***    Copyright (C) 2011  Jiri Novak <jiri.novak@petriny.net>
 ***                        Wadi Jalil Maluf <wadijm@gmail.com>
 ***
 ***    This file is part of the Screencasting Teaching System C++ Library.
 ***
 ***    This library is free software; you can redistribute it and/or modify
 ***    it under the terms of the GNU General Public License as published by
 ***   the Free Software Foundation; either version 3 of the License, or
 ***    (at your option) any later version.
 ***
 ***    This library is distributed in the hope that it will be useful,
 ***    but WITHOUT ANY WARRANTY; without even the implied warranty of
 ***    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ***   GNU General Public License for more details.
 ***
 ***    You should have received a copy of the GNU General Public License
 ***    along with this library; if not, write to the Free Software
 ***    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ***
 *********************************************************************************/

#include <gtest/gtest.h>
#include <string>
#include <vector>
#include "../src/common/model/lesson.h"
#include "../src/common/comm/operation.h"
#include "../src/server/scpersistenceservice.h"
#include <iostream>
#include <fstream>
#include <stdio.h>
/**
 * Test of persistence service
 */
TEST(ScPersistenceServiceTest, testScSendAndPlayback) {
 /** std::string path="../conf";
    // Removes previous file
    remove("../conf/scdemo");
    // Init variables and persist some lesson data
    Lesson lesson;
    lesson.setName("scdemo");
    ScPersistenceService * scService=new ScPersistenceService(lesson,path);
    scService->openForWriting();
    std::string data="data of screencast data";
    Operation op;
    op.setType(88);
    op.setData(data);
    op.serialize();
    scService->persistScreenCastData((char* )&op.getBuffer().at(0),op.getBuffer().size());
    delete scService;

    // Now we try to read the persisted data
    scService=new ScPersistenceService(lesson,path);
    scService->openForReading();
    BlockingQueue queue;
    scService->iterateScreencastMessage(queue);
    std::vector<char> bytes=queue.take();
    Operation operation;
    operation.add((unsigned char*)&bytes.at(0),bytes.size());
    std::string dataRecuperada= operation.getData();
//    EXPECT_STREQ(data.c_str(), dataRecuperada.c_str());
    delete scService;*/
}


